import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QrResultVO, QrResultForm, QrResultQuery } from '@/api/stroke/qrResult/types';

/**
 * 查询QR测算问卷结果列表
 * @param query
 * @returns {*}
 */

export const listQrResult = (query?: QrResultQuery): AxiosPromise<QrResultVO[]> => {
  return request({
    url: '/stroke/qrResult/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询QR测算问卷结果详细
 * @param id
 */
export const getQrResult = (id: string | number): AxiosPromise<QrResultVO> => {
  return request({
    url: '/stroke/qrResult/' + id,
    method: 'get'
  });
};

/**
 * 新增QR测算问卷结果
 * @param data
 */
export const addQrResult = (data: QrResultForm) => {
  return request({
    url: '/stroke/qrResult',
    method: 'post',
    data: data
  });
};

/**
 * 修改QR测算问卷结果
 * @param data
 */
export const updateQrResult = (data: QrResultForm) => {
  return request({
    url: '/stroke/qrResult',
    method: 'put',
    data: data
  });
};

/**
 * 删除QR测算问卷结果
 * @param id
 */
export const delQrResult = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/qrResult/' + id,
    method: 'delete'
  });
};
